﻿<?php
// ------------------------------------------------------------------
// NEEDED STUBS FOR THIS EXAMPLE
// ------------------------------------------------------------------


// this will include all needed files to be able to build a Request
include_once($CONF["STUBS_FOLDER"]."Map24TrafficInfo/Map24TrafficInfo.php5");


// ------------------------------------------------------------------
// NEEDED PARAMETERS FOR THIS REQUEST
// ------------------------------------------------------------------


// filter infos for a speacial street
$StreetFilterName="A5";
// synchronize applet data
$SynchronizeClientData 	= TRUE;
// show traffic infos on map
$SynchronizeClientView 	= TRUE;
// gemometry Details
$GetGeometry 			= TRUE;
// traffic Details
$GetTMCDetails			= TRUE;


// ------------------------------------------------------------------
// BUILDING THE REQUEST
// ------------------------------------------------------------------


// definition of the request header with Map24ID and SessionID
$header = new RequestHeader();
$header->Map24ID  = $CONF['MAP24_ID'];
$header->ClientID = $CONF['SESSION_ID'];

// definition of the request body
$request = new GetTrafficInfosRequest();
$request->ProviderNameFilter="tipdef";
$request->StreetFilter=new TMCFilter();
$request->StreetFilter->Name = $StreetFilterName;
$request->GetTMCDetails = $GetTMCDetails;
$request->GetGeometry = $GetGeometry;
$request->SynchronizeClientData = $SynchronizeClientData;
$request->SynchronizeClientView = $SynchronizeClientView;


// ------------------------------------------------------------------
// EXECUTE THE REQUEST
// ------------------------------------------------------------------


// in this object the SoapClient will be initiated and executed
$maploc = new Map24TrafficInfo($CONF['MAPTP_SYSTEM'],$CONF['MAP24_ID'],$CONF['SESSION_ID']);
$response = $maploc->getTrafficInfos($header,$request);


// ------------------------------------------------------------------
// OUTPUT THE RESULT
// ------------------------------------------------------------------


if( isset($response->TrafficInfos) )
{
	foreach ($response->TrafficInfos as $result)
	{
		$counter++;

		$resultString .= "<div style='border:1px solid black;margin:2px 0px;padding:5px;'>".$counter.". ";
		$resultString .= "<b>Street: " . $result->Street . "</b><br /><br />";
		$resultString .= "SegmentText: " . $result->SegmentText . "<br /><br />";
		$resultString .= "MessageText: " . $result->MessageText . "<br /><br />";
		$resultString .= "</div>";
	}
}
else
{
	$resultString = "There are no traffic infos for $StreetFilterName";
}
?>